package iosr11.Service;

import java.util.Map;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class ServiceLocatorImpl_old implements ServiceLocator {
	private static ServiceLocator locator;
	private static BeanFactory beanFactory;
	
	private Map<Class, Service> serwices;
	
	private ServiceLocatorImpl_old(){
		beanFactory = new ClassPathXmlApplicationContext("service.xml");
	}
	
	public static ServiceLocator getInstance(){
		if (locator == null)
			locator = new ServiceLocatorImpl_old();
		return locator;
	}

	@Override
	public Object getService(Class entity) {
		return beanFactory.getBean(entity.getName());
	}

	public void setSerwices(Service service) {
		this.serwices.put(service.getServiceEntityClass(), service);
	}
	
	
}
